public class Z2 {
    public static void main(String[] args) {
        //2.	求1-100之间所有3的倍数的和
        int sum = 0;
         /*for(int i=1; i<=100;i++){
             if (i%3==0){
                 sum+=i;
             }
         }
        System.out.println("1-100之间3的倍数总和："+sum);*/
        int num = 1;
        while (num <= 100) {
            if (num % 3 == 0) {
                sum += num;
            }
            num++;
        }
        System.out.println("1-100之间3的倍数总和：" + sum);
    }}

